/*
 * Copyright (c) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef SWANLINK_FINANCE_RECPTPRINTER_SRV_PROXY_H
#define SWANLINK_FINANCE_RECPTPRINTER_SRV_PROXY_H

#include "irecptprinter_srv.h"
#include "nocopyable.h"
#include "iremote_proxy.h"
#include "cashdevice_proxy.h"
#include "recptprinter_observer_stub.h"
#include "irecptprinter_observer.h"

namespace SwanLink {
namespace Finance {
class RecptprinterSrvProxy : public IRemoteProxy<IRecptprinterSrv>, public CashDeviceSrvProxy {
 public:
    explicit RecptprinterSrvProxy(const sptr<IRemoteObject>& impl)
        : IRemoteProxy<IRecptprinterSrv>(impl),
        CashDeviceSrvProxy(impl, IRecptprinterSrv::GetDescriptor()) {}
    ~RecptprinterSrvProxy() = default;
    DISALLOW_COPY_AND_MOVE(RecptprinterSrvProxy);

    COMMON_FUNC_DEFINE(CashDeviceSrvProxy)
    /**
     * 获取打印格式
     */
    int GetPrintFormat(int handle,PrintFormatType ftt) override;
    /**
     * 设置打印格式
     */
    void SetPrintFormat(int handle, PrintFormatType ftt, int value) override;
    /**
     * 获取设备配置
     */
    void GetDeviceSpec(int handle, DeviceSpec &spec) override;
    /**
     * 走纸
     */
    int FeedPaper(int handle, int line) override;
    /**
     * 切纸
     */
    int CutPaper(int handle, int line, int mode) override;
    /** 
     * 添加文本
     */
    int AddText(int handle, int x, int y, const std::string& text) override;
    /**
     * 添加图片
     */
    int AddBitmap(int handle, int x, int y, const std::string& lpath) override;
    /**
     * 添加二维码
     */
    int AddQRCode(int handle, int x, int y, int w, const std::string& qr) override;
    /**
     * 添加条码
     */
    int AddBarCode(int handle, int x, int y, BarCodeSpec &spec, const std::string& bar) override;
    /**
     * 开始打印
     */
    void StartPrint(int handle, int timeout, PrintListener *listener) override;

 private:
    static inline BrokerDelegator<RecptprinterSrvProxy> delegator_;
    // sptr<IRecptprinterObserver> remote_observer_;
};
}  // namespace Finance
}  // namespace SwanLink

#endif  // SWANLINK_FINANCE_RECPTPRINTER_SRV_PROXY_H

